From 8c22c9b09f84c89952ee53ef2364e2ff3aa1121c Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 29 Sep 2006 11:50:51 +0100 Subject: [PATCH] [HVM][SVM] Obtaining instruction address needs to mask to 32 bits if not running in 64-bit mode. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/svm/emulate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c index 194a8be7fc..5adaa8d50d 100644 --- a/xen/arch/x86/hvm/svm/emulate.c +++ b/xen/arch/x86/hvm/svm/emulate.c @@ -341,7 +341,11 @@ unsigned long svm_rip2pointer(struct vmcb_struct *vmcb) * %cs is update, but fortunately, base contain the valid base address * no matter what kind of addressing is used. */ - return vmcb->cs.base + vmcb->rip; + unsigned long p = vmcb->cs.base + vmcb->rip; + if (!(vmcb->cs.attributes.fields.l && vmcb->efer & EFER_LMA)) + return (u32)p; /* mask to 32 bits */ + /* NB. Should mask to 16 bits if in real mode or 16-bit protected mode. */ + return p; } -- 2.30.2